<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8" />
    <title>Title</title>
    <style type="text/css">
        table tr td{border:1px solid black;}
    </style>
</head>
<body>
<%--<p th:text="'Hello, ' + ${name} + '!'" />--%>
<!-- 如果用户列表为空 -->
<c:if test="${empty list}">
    <div class="alert alert-warning" role="alert">
        <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>User表为空，请<a href="/admin/users/add" type="button" class="btn btn-primary btn-sm">添加</a>
    </div>
</c:if>
<!-- 如果用户列表非空 -->
<c:if test="${!empty list}">
    <table class="table table-bordered table-striped">
        <tr>
            <th  style="width: 10%;">ID</th>
            <th  style="width: 10%;">昵称</th>
            <th  style="width: 80%;">姓名</th>
        </tr>

        <c:forEach items="${list}" var="user">
        <tr>
            <td>${user.id}</td>
            <td>${user.nickname}</td>
            <td>
                <table class="table table-bordered table-striped">
                    <tr>
                        <th>TITLE</th>
                        <th>CONTENT</th>
                        <th>IDate</th>
                    </tr>
                    <c:forEach items="${list.blogs}" var="b">
                    <tr>
                        <td>${b.title}</td>
                        <td>${b.content}</td>
                        <td>${b.pub_date}</td>
                    </tr>
                    </c:forEach>
                </table>
            </td>
        </tr>
        </c:forEach>
    </table>
</c:if>

</body>
</html>